package com.jinzhi.jinzhidata.repository;

import com.jinzhi.jinzhidata.dataobject.CarouselFigure;
import com.jinzhi.jinzhidata.vo.ListCarouselFigureVO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author vansl
 * @description
 * @date 2020-01-19 13:00
 **/
@Repository
public interface CarouselFigureRepository extends JpaRepository<CarouselFigure, String> {

    @Query("select new com.jinzhi.jinzhidata.vo.ListCarouselFigureVO( " +
            "c.carouselFigureId,c.carouselFigureImage,c.articleId," +
            "a.articleTitle,c.createTime,c.updateTime) " +
            "from CarouselFigure c,Article a " +
            "where c.articleId = a.articleId order by c.createTime desc")
    List<ListCarouselFigureVO> selectList();
}
